﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WMS.API.Application.Command.InventoryManagement;
using WMS.Domain.Entities.InventoryManagement;
using WMS.ErrorCode;

namespace WMS.API.Controllers.InventoryManagement
{
    /// <summary>
    /// 库存出入库控制器-grx
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InandoutofStorageController : ControllerBase
    {
        private readonly IMediator _mediator;
        public InandoutofStorageController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 新增库存出入库-grx
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddInandoutofStorage(AddInandoutofStorageCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 库存出入库明细-grx
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPaging<InandoutofStorage>>> QueryInandoutofStorage([FromQuery] QueryInandoutofStorageCommand request)
        {
            return _mediator.Send(request);
        }
    }
}
